import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'
import Info from '../views/Journalism/info'
import Welcome from '../views/welcome'
import Cemetery from '../views/lingyuan/cemetery'
import Cemeterydetails from '../views/lingyuan/Cemeterydetails'
import Funeralhome from '../views/bingyiguan/funeralhome'
import Funeradetail from '../views/bingyiguan/funeradetail'
import Service from '../views/fuwuliucheng/service'
import Aboutus from '../views/guanyuwomen/aboutus'
import Contactus from '../views/lianxiwomen/contactus'
import Infodetail from '../views/Journalism/infodetail'
import Articles from '../views/bingzhangyongping/articles'
import Articledetail from '../views/bingzhangyongping/articledetail'

Vue.use(VueRouter)

const routes = [{
            path: '/',
            component: Home,
            redirect: '/welcome',
            children: [{
                path: '/welcome',
                component: Welcome
            }, {
                path: '/info',
                component: Info
            }, {
                path: '/cemetery',
                component: Cemetery,
            }, {
                path: '/Cemeterydetails',
                component: Cemeterydetails
            }, {
                path: '/funeralhome',
                component: Funeralhome
            }, {
                path: '/funeradetail',
                component: Funeradetail
            }, {
                path: '/service',
                component: Service
            }, {
                path: '/aboutus',
                component: Aboutus
            }, {
                path: '/contactus',
                component: Contactus
            }, {
                path: '/infodetail',
                component: Infodetail
            }, {
                path: '/articles',
                component: Articles
            }, {
                path: '/articledetail',
                component: Articledetail
            }]
        },
        {
            path: '/about',
            name: 'About',
            // route level code-splitting
            // this generates a separate chunk (about.[hash].js) for this route
            // which is lazy-loaded when the route is visited.
            component: () =>
                import ( /* webpackChunkName: "about" */ '../views/About.vue')
        },

    ]
    // 解决路由重复报错
const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
    return originalPush.call(this, location).catch(err => err)
}

const router = new VueRouter({
    routes
})

export default router